﻿using System;
using System.Collections;
using System.Collections.Generic;

namespace ConsoleApp8
{
    class Program
    {

        static string[,] table1 = new string[,]{
       { "2","li"},
       {"1","asd"},
       {"3","qwe"},
       {"5","sad"}
        };
        static string[,] table2 = new string[,]{
       {"1","asd"},
       {"3","qwe"},
       {"5","sad"}
        };
        static string[,] table3 = new string[,]{
       { "2","li"},
       {"1","asd"},
        };
        List<string[,]> tables = new List<string[,]>();
 

        static void Main(string[] args)
        {
            ArrayList arr = new ArrayList();

            for (int i = 0; i < 3; i++)

            {

                arr.Add(i);

            }

            arr.RemoveAt(1);

            Console.WriteLine(arr.Count);

            Console.WriteLine(arr.Capacity);



            SortedList mySL = new SortedList();

            mySL.Add(1.3, "fox");

            mySL.Add(1.4, "jumped");

            mySL.Add(1.5, "over");

            mySL.Add(1.2, "brown");

            mySL.Add(1.1, "quick");

            mySL.Add(1.0, "The");

            mySL.Add(1.6, "the");

            mySL.Add(1.8, "dog");

            mySL.Add(1.7, "lazy");


            int myIndex = 3;

            Console.WriteLine("The key at index {0} is {1}.", myIndex, mySL.GetKey(myIndex));

            Console.WriteLine("The value at index {0} is {1}.", myIndex, mySL.GetByIndex(myIndex));


            List<string[,]> tables = new List<string[,]>();
            tables.Add(table1);
            tables.Add(table2);
            tables.Add(table3);
            SortedList<string, string> list = new SortedList<string, string>();
            for (int i = 0; i < tables.Count; i++)
            {
                for (int j = 0; j < tables[i].Length / tables[i].Rank; j++) 
                if (!list.ContainsKey(tables[i][j, 0]))
                list.Add(tables[i][j, 0], tables[i][j, 1]);
            }
            ICollection<string> keys = list.Keys;
            foreach (string key in keys) 
            {
                Console.WriteLine(key + " " + list[key]);
            }
            Console.ReadKey();



           
  

        }
    }
}
